package com.xiaoshuidi.cloud.module.bpm.enums.swo;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum TicketSourceEnum {

    TENANTS("租客", 1),
    INTERIOR("内部", 2);

    private String name;
    private Integer value;

    public static String getNameByValue(Integer value) {
        TicketSourceEnum ticketSourceEnum = Arrays.stream(TicketSourceEnum.values()).filter(p -> p.getValue().equals(value)).findFirst().orElse(null);
        if (ObjectUtil.isEmpty(ticketSourceEnum)) {
            return "";
        }
        return ticketSourceEnum.getName();
    }
}
